import { createI18n } from 'vue-i18n';
import messages from '@intlify/unplugin-vue-i18n/messages';

const localLang = localStorage.getItem('lang');
const fallbackLocale = 'zh-Hans';

const currentLang = localLang ? localLang : fallbackLocale;

const i18n = createI18n<false>({
  locale: currentLang,
  messages: messages,
  fallbackLocale: fallbackLocale,
  legacy: false,
  globalInjection: false
});

const t = i18n.global.t;
export default i18n;

export { t };
